import { network } from '@/utils';
import { TableListParams } from './data';

import { basic } from '../../../../../../config/Apis';

export async function queryMouthDetailsList(params: TableListParams) {
  return network.get(basic.cell_list, { params });
}

export async function queryCellTypeInfo() {
  return network.get(basic.other_cellType);
}

export async function queryStatusInfo() {
  return network.get(basic.other_cellStatus);
}

export async function operCheckCellOrder(params: { cellId: number }) {
  return network.get(basic.cell_checkCellOrder, { params });
}

export async function operUpdateMouth(params: { cellId: number; type: string }) {
  const { type, ...query } = params;
  return network.put(basic[type], { data: query });
}

export async function operUpdateDesc(params: { cabinetId: number }) {
  return network.put(basic.cell_updateDesc, { data: params });
}

export async function operActionOpenCell(params: { cellId: number }) {
  return network.post(basic.cell_openCell, { data: params });
}

export async function queryDetailInfo(params: { id: number }) {
  return network.get(basic.cab, { params });
}

export async function queryCollectionLastInfo(params: { id: number }) {
  return network.get(basic.cab_collection_last, { params });
}

export async function operactionSeting(params: any) {
  const { type, ...query } = params;
  return network.post(type === 1 ? basic.cab_addOldSlave : basic.cab_deleteOldSlave, {
    data: query,
  });
}

// 批量置空闲
export async function queryUpdateCellIdle(params: any[]) {
  return network.put(basic.allCell_updateCellIdle, { data: params });
}
